home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / QuickDraw GX / QuickDraw GX Info / QuickDraw GX Interfaces / Interfaces & Libraries / interfaces / layout library.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-30  |  4.3 KB  |  142 lines  |  [TEXT/MPS ]

  1. /* graphics libraries:
  2.     layout library interface: Line Layout support routines
  3.   by Dave Opstad, Eric Mader
  4.     Copyright 1990 - 1993 Apple Computer, Inc.  All rights reserved. */
  5.  
  6. #pragma once
  7. #ifndef layoutLibraryIncludes
  8.     #define layoutLibraryIncludes
  9.     
  10.     #ifndef graphicsRoutinesIncludes
  11.     #include "graphics routines.h"
  12.     #endif
  13.     
  14.     #ifndef layoutTypesIncludes
  15.     #include "layout types.h"
  16.     #endif
  17.     
  18.     #ifdef __cplusplus
  19.     extern "C" {
  20.     #endif
  21.     
  22.     struct StyleRunOverrides {
  23.       gxPriorityJustificationOverride *priorityJustOverride;
  24.       gxGlyphJustificationOverride    *glyphJustOverrides;
  25.       long                          glyphJustOverridesCount;
  26.       gxGlyphSubstitution             *glyphSubstitutions;
  27.       long                          glyphSubstitutionsCount;
  28.       gxKerningAdjustment             *kerningAdjustments;
  29.       long                          kerningAdjustmentsCount;
  30.     };
  31.     
  32.     struct ParagraphRecord {
  33.       short nLayouts;
  34.       Fixed totalHeight;
  35.       gxShape layouts[gxAnyNumber];
  36.     };
  37.         
  38.     typedef struct ParagraphRecord** ParagraphRecordHandle;
  39.  
  40.     struct RunFeatureTypeName {
  41.       gxRunFeatureType  featureType;
  42.       unsigned short  nSelectors;
  43.       unsigned short  selectorTableOffset;
  44.       short           nameIndex;
  45.     };
  46.     
  47.     struct RunFeatureSelectorName {
  48.       gxRunFeatureSelector  featureSelector;
  49.       short               nameIndex;
  50.     };
  51.     
  52.     #ifndef __cplusplus
  53.         typedef struct StyleRunOverrides StyleRunOverrides;
  54.         typedef struct ParagraphRecord ParagraphRecord;
  55.         typedef struct RunFeatureTypeName RunFeatureTypeName;
  56.         typedef struct RunFeatureSelectorName RunFeatureSelectorName;
  57.     #endif
  58.     
  59.     void InitializeRunControls (gxRunControls *runControls);
  60.     
  61.     void InitializeLayoutOptions (gxLayoutOptions *layoutOptions);
  62.     
  63.     void InitializeStyleRunOverrides (StyleRunOverrides *overrides);
  64.     
  65.     void SetDefaultPriorityJustOverride (gxPriorityJustificationOverride *override);
  66.     
  67.     void SetLayoutStyle (
  68.       gxStyle             s,
  69.       char              *gxFontName,
  70.       Fixed             textSize,
  71.       gxTextAttribute     attr,
  72.       gxRunControls       *runControls,
  73.       gxRunFeature        runFeatures[],
  74.       long              runFeaturesCount,
  75.       StyleRunOverrides *overrides);
  76.     
  77.     gxStyle NewLayoutStyle (
  78.       char              *gxFontName,
  79.       Fixed             textSize,
  80.       gxTextAttribute     attr,
  81.       gxRunControls       *runControls,
  82.       gxRunFeature        runFeatures[],
  83.       long              runFeaturesCount,
  84.       StyleRunOverrides *overrides);
  85.     
  86.     gxShape NewSingleLayout (
  87.       char              *text,
  88.       char              *gxFontName,
  89.       Fixed             textSize,
  90.       gxLayoutOptions     *options,
  91.       gxPoint             *position,
  92.       gxTextAttribute     attr,
  93.       gxRunControls       *runControls,
  94.       gxRunFeature        runFeatures[],
  95.       long              runFeaturesCount,
  96.       StyleRunOverrides *overrides);
  97.     
  98.     /* The following functions provide a limited paragraph-creation function. They make calls
  99.         to GetWidthArray and do simple gxLine-breaking using the obtained widths.
  100.         
  101.         !!! IMPORTANT NOTE FOLLOWS !!!
  102.         
  103.         These functions need to be able to deal with text in multiple scripts, which might
  104.         contain zero bytes. Therefore calls that determine hard stops (such as NewParagraph)
  105.         do NOT stop at zero bytes; this means that just passing in a single C string is NOT
  106.         sufficient! Callers will need to add a carriage return themselves to the end of the
  107.         text source. */
  108.     
  109.     ParagraphRecordHandle NewParagraph(
  110.       char    *text,
  111.       gxStyle   baseStyle,
  112.       Fixed   width,
  113.       long    justified,      /* really a boolean; this way for compiler difference reasons */
  114.       Fixed   lineHeight,     /* if zero, we will deduce */
  115.       gxPoint   *firstOrigin);  /* origin of first gxLine in paragraph */
  116.     
  117.     ParagraphRecordHandle NewStyledParagraph(
  118.       long                textRunCount,
  119.       const void          *text[],
  120.       const short         textRunLengths[],
  121.       long                styleRunCount,
  122.       const gxStyle         styles[],
  123.       const short         styleRunLengths[],
  124.       long                levelRunCount,
  125.       const short         levels[],
  126.       const short         levelRunLengths[],
  127.       long                totalByteCount,
  128.       const gxLayoutOptions *layoutOptions,
  129.       Fixed               lineHeight,
  130.       const gxPoint         *firstOrigin);
  131.     
  132.     void DisposeParagraph(ParagraphRecordHandle paraRec);
  133.     
  134.     /* GetLayoutBounds can be used to return the bounds of a layout. */
  135.     
  136.     gxShape GetLayoutBounds(gxShape layout);
  137.     
  138.     #ifdef __cplusplus
  139.     }
  140.     #endif
  141. #endif
  142.